<?php
/**
 * Ecma-262 5rd A.1 Lexical Grammar
 * 
 */
class Token extends InputElement{
    
    const COMMENT = -300;
    
    const EOL = -200;
    
    const EOF = -100;
    
    const Unknown = 0;
    
    const IdentifierName = 100;
    
    const Punctuator = 200;
        const Punctuator_LeftBrace  = 201;          // {
        const Punctuator_RightBrace = 202;          // }
        const Punctuator_LeftParenthesis = 203;     // (
        const Punctuator_RightParenthesis = 204;    // )
        const Punctuator_LeftSquareBrace = 205;     // [
        const Punctuator_RightSquareBrace = 206;    // ]
        const Punctuator_Dot = 207;                 // .
        const Punctuator_Semicolon = 208;           // ;
        const Punctuator_Comma = 209;               // ,
        const Punctuator_Add = 210;                 // +
        const Punctuator_AddAdd = 211;              // ++
        const Punctuator_AddEqual = 212;            // +=
        const Punctuator_Minus = 213;               // -
        const Punctuator_MinusMinus = 214;          // --
        const Punctuator_MinusEqual = 215;          // -=
        const Punctuator_Asterisk = 216;            // *
        const Punctuator_AsteriskEqual = 217;       // *=
        const Punctuator_Percent  = 218;            // %
        const Punctuator_PercentEqual  = 219;       // %=
        const Punctuator_And  = 220;                // &
        const Punctuator_AndAnd  = 221;             // &&
        const Punctuator_AndEqual = 222;            // &=
        const Punctuator_Or  = 223;                 // |
        const Punctuator_OrOr  = 224;               // ||
        const Punctuator_OrEqual = 225;             // |=
        const Punctuator_Less = 226;                // <
        const Punctuator_LessEqual = 227;           // <=
        const Punctuator_LessLess = 228;            // <<
        const Punctuator_LessLessEqual = 229;       // <<=
        const Punctuator_More = 230;                // >
        const Punctuator_MoreEqual = 231;           // >=
        const Punctuator_MoreMore = 232;            // >>
        const Punctuator_MoreMoreMore = 233;        // >>>
        const Punctuator_MoreMoreEqual = 234;       // >>=
        const Punctuator_MoreMoreMoreEqual = 235;   // >>>=
        const Punctuator_ExclusiveOr = 236;         // ^
        const Punctuator_ExclusiveOrEqual = 237;    // ^=
        const Punctuator_Not = 238;                 // !
        const Punctuator_NotEqual = 239;            // !=
        const Punctuator_NotEqualEqual = 240;       // !==
        const Punctuator_Ask = 241;                 // ?
        const Punctuator_Colon = 242;               // :
        const Punctuator_Equal = 243;               // =
        const Punctuator_EqualEqual = 244;          // ==
        const Punctuator_EqualEqualEqual = 245;     // ===
        const Punctuator_Division = 246;            // /
        const Punctuator_DivisionEqual = 247;       // /=
        const Punctuator_BitNot = 248;              // ~
        
    const NumericLiteral = 300;
    
    const StringLiteral = 400;
    
    /**
     * 
     * @var int
     */
    public $tokenType;
    
    /**
     * token的字面
     * @var string
     */
    public $tokenLiteral;
    
    /**
     * token的长度
     * @var int
     */
    public $tokenLength;
    
    /**
     * token从一行的第几个字符开始
     * @var int
     */
    public $tokenPosition;
    
    /**
     * token所处的行号
     * @var int
     */
    public $lineNumber;
    
    
    public function __construct(){
        parent::__construct ();
        $this->inputElementType = InputElement::Token;
        $this->tokenType = Token::Unknown;
        $this->tokenLiteral = '';
        $this->tokenLength = 0;
        $this->tokenPosition = 0;
        $this->lineNumber = 0;
    }
    
    /**
     * @return the $tokenType
     */
    public function getTokenType() {
        return $this->tokenType;
    }
    
    /**
     * @return the $tokenLiteral
     */
    public function getTokenLiteral() {
        return $this->tokenLiteral;
    }
    
    /**
     * @return the $tokenLength
     */
    public function getTokenLength() {
        return $this->tokenLength;
    }
    
    /**
     * @return the $tokenPosition
     */
    public function getTokenPosition() {
        return $this->tokenPosition;
    }
    
    /**
     * @return the $lineNumber
     */
    public function getLineNumber() {
        return $this->lineNumber;
    }
    
    /**
     * @param int $tokenType
     */
    public function setTokenType($tokenType) {
        $this->tokenType = $tokenType;
    }
    
    /**
     * @param string $tokenLiteral
     */
    public function setTokenLiteral($tokenLiteral) {
        $this->tokenLiteral = $tokenLiteral;
    }
    
    /**
     * @param int $tokenLength
     */
    public function setTokenLength($tokenLength) {
        $this->tokenLength = $tokenLength;
    }
    
    /**
     * @param int $tokenPosition
     */
    public function setTokenPosition($tokenPosition) {
        $this->tokenPosition = $tokenPosition;
    }
    
    /**
     * @param int $lineNumber
     */
    public function setLineNumber($lineNumber) {
        $this->lineNumber = $lineNumber;
    }
    
    
    
    
}